using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class uicontrol_Calendar : System.Web.UI.UserControl
{
     

    protected void Page_Load(object sender, EventArgs e)
    {
      //  txtCalendar.Text = DateTime.Now.ToString("dd/MM/yyyy");
      btn_calendar_Click.OnClientClick = "return showCalendar('" + this.FindControl("txtCalendar").ClientID + "')";
      txtCalendar.Text = DateTime.Now.ToString("dd/MM/yyyy");
    }

    public String getDateTimeValue()
    {
       return txtCalendar.Text;

    }
    public String getLabel() { return lbl_calendar.Text; }
    public void setLabel(String label) { lbl_calendar.Text = label; }
    public void setEnabled(bool Enabled)
    {
        txtCalendar.Enabled = Enabled;
    }
    
    public void setEditable(bool Editable)
    {
        //txtCalendar.ReadOnly = !Editable;
        txtCalendar.Enabled = !Editable;
    }
    public void setValue(String value) {
        txtCalendar.Text = value;
    }
    public String Text {
        set { txtCalendar.Text = value; }
        get { return txtCalendar.Text; }
    }
    public String getDayValue() {
        String[] splitDate = txtCalendar.Text.Split('/');
        return splitDate[0];
    }
    public String getMonthValue()
    {
        String[] splitDate = txtCalendar.Text.Split('/');
        return splitDate[1];
    }
    public String getYearValue()
    {
        String[] splitDate = txtCalendar.Text.Split('/');
        return splitDate[2];
    }
    public int getDay() {
        return int.Parse(getDayValue());
    }
    
    public int getMonth()
    {
        return int.Parse(getMonthValue());
    }
    public int getYear()
    {
        return int.Parse(getYearValue());
    }
    public DateTime getDateTime() {
        
        return new DateTime(getYear(), getMonth(), getDay());
    }
   
   
}
